1. Field of the Invention
This invention relates to a method and apparatus for serializing access to a shared resource in an information handling system and, more particularly, to a method and apparatus for serializing access by a plurality of entities such as processors, processes or users to such a shared resource.
2. Description of the Related Art
In information handling systems, processors, applications or other entities frequently must access shared resources (files, memory regions and the like) that are potentially being simultaneously accessed by another entity. Such systems conventionally use lock managers to serialize access to a resource, ensuring that only a single entity accesses a resource at any one time. Such lock managers typically use a resource serialization variable (RSV) that is atomically tested and set to acquire a lock on the resource for the requester. Various instructions are available for implementing such atomic operations, such as Test and Set (TS), Compare and Swap (CS) and Compare Double and Swap (CDS) in an IBM S/390.RTM. environment.
In a lock manager that allows queuing of lock requests, an efficient mechanism is needed to ensure that queued waiters are given fair access to the lock. If a list of waiters is kept in the order in which they requested the lock, then the lock manager can do one of several things. First, it can preallocate storage for a maximum number of waiters. However, in systems with low contention, this wastes large amounts of storage. Second, a lock manager can allocate storage for each waiter as each request arrives. This has a tendency to fragment storage, though, reducing the effectiveness of the lock manager. What is desired, therefore, is a lock manager that conserves storage, as well as one that does not fragment storage.